﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using GeneralMotionControlProject.Common;
using GeneralMotionControlProject.Common.Services;
using Microsoft.EntityFrameworkCore;

namespace ModuleBase
{
    public class MDbContext : DbContext
    {
        private readonly IPropertisSettingsProvider propertisSettingsProvider;
        public MDbContext(IPropertisSettingsProvider _propertisSettingsProvider)
        {
            propertisSettingsProvider = _propertisSettingsProvider;
        }
        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            optionsBuilder.UseSqlite($"Data Source={System.IO.Path.Join(System.AppDomain.CurrentDomain.BaseDirectory, propertisSettingsProvider.GetPartnumSettingValue(), propertisSettingsProvider.GetBoardIndexSettingValue().ToString(), "point.db")}");
        }
        public DbSet<MParam> MParams { get; set; }
        public DbSet<FlyGrabPoint> FlyGrabPoints { get; set; }
        public DbSet<VisionProject> VisionProjects { get; set; }
        public DbSet<XYZPoint> XYZPoints { get; set; }
        public DbSet<VisionPoint> VisionPoints { get; set; }
        public DbSet<VisionScript> VisionScripts { get; set; }
    }
}
